package com.cwj.service.impl;

import com.cwj.dao.NetworkDao;
import com.cwj.pojo.*;
import com.cwj.service.NetworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ACER
 */
@Service
public class NetworkServiceImpl implements NetworkService {
    @Autowired
    private NetworkDao networkDao;

    @Override
    public boolean login(User user) {
        List<User> users = networkDao.getUser(user);
        boolean flag = false;
        if (users.size() != 0){
            flag = true;
        }
        return flag;
    }

    @Override
    public List<Message> getMessage() {
        return networkDao.getMessage();
    }

    @Override
    public void saveMessage(String message) {
        networkDao.saveMessage(message);
    }

    @Override
    public User getUser(String account, String password) {
        return networkDao.userLogin(account,password);
    }

    @Override
    public Admin getAdmin(String account, String password) {
        return networkDao.adminLogin(account,password);
    }

    @Override
    public User getTest(String account) {
        return networkDao.getTest(account);
    }

    @Override
    public void updata(User user) {
        networkDao.updata(user);
    }

    @Override
    public Users getUsers(int uid) {
        return networkDao.getUsers(uid);
    }

    @Override
    public void updataUsers(Users users) {
        networkDao.updataUsers(users);
    }

    @Override
    public void setMessage(String message) {
        networkDao.setMessage(message);
    }

    @Override
    public List<User02> numSQL(String uid) {
        return networkDao.numSQL(uid);
    }

    @Override
    public List<User02> strSQL(String uid) {
        return networkDao.strSQL(uid);
    }

    @Override
    public User03 user03Login(String username, String password) {
        return networkDao.user03Login(username,password);
    }

    @Override
    public User03 getUser03(String username) {
        return networkDao.getUser03(username);
    }

}
